package com.foreveross.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.foreveross.common.Constants;
import com.foreveross.dao.ReservationDAO;
import com.foreveross.dao.SysRoleMenuManagerDAO;
import com.foreveross.vo.OrderService;
import com.foreveross.vo.common.PageVo;
import com.foreveross.vo.common.ResultVo;

@Service("reservationService")
@Transactional
public class ReservationService extends BaseService {

	@Resource
	ReservationDAO reservationDAO;

	public long findReservationListCount(String weixinId,String isweixin,String name,String type,String phone,String houseId,String status,String userId,String resCode) throws Exception{
		return reservationDAO.findReservationListCount(weixinId, isweixin, name, type, phone, houseId, status, userId,resCode);
	}
	
	public List<OrderService> findReservationList(String weixinId, int currentPage,
			int pageSize, ResultVo resultVo, String isweixin, String name,
			String type, String phone, String houseId, String status,String userId,String resCode)
			throws Exception {
		return reservationDAO.findReservationList(weixinId, currentPage, pageSize, isweixin, name, type, phone,houseId, status,userId,resCode);
	}

	public void saveOrUpdate(OrderService orderService, String updateType)
			throws Exception {
		if (updateType.equals(Constants.UPDATE_ADD)) {
			reservationDAO.save(orderService);
		} else if (updateType.equals(Constants.UPDATE_EDIT)) {
			reservationDAO.updateStatusAndOrderTimeById(orderService);
		}

	}

	public void deleteReservation(String ids) throws Exception {
		for (String id : ids.split(",")) {
			reservationDAO.deleteReservation(id);
		}
	}
}
